import React from 'react';
import { Consumer } from './ContextBox';
import ContextChil2 from './ContextChil2';

export default function ContextChil(props) {
  // console.log('ContextChil 接受来自父组件的 Context 中的value中设置的默认值', props);

  return (
    <React.StrictMode>
      <h2>Context Child</h2>

      <Consumer>
        {obj => {
          // console.log("ContextChil 组件", obj);
          return (
            <div>
              <p>ContextChil: {JSON.stringify(obj)}</p>
            </div>
          );
        }}
      </Consumer>

      <ContextChil2 />
    </React.StrictMode>
  );
}
